From: Carlos Garnacho Date: Mon, 10 Sep 2018 12:24:57 +0000 (+0200) Subject: dnd: Avoid breaking drag state on cancellation X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~897^2^2~116 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7a86637f8d6e3a04d4aa2e293963b62b7da6d59f;p=gnome-shell.git dnd: Avoid breaking drag state on cancellation In the case where the draggable has an actor of its own, state could be left broken when dragging on a place that would not accept the DnD op. After button release, drag state is set to "cancelled" and the animation begins. After the animation is finished, the drag actor would be destroyed before disconnecting from its destroy handler. Within the destroy handler, the grab would be undone but drag state would be left on "cancelled" state for subsequent operations. This results in DnD oddities and stuck grabs. In order to fix this, double check in the actor destroy handler that we are actually dragging before setting the "cancelled" state. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/540 --- diff --git a/js/ui/dnd.js b/js/ui/dnd.js index 0562c7cbd..23af7ba95 100644 --- a/js/ui/dnd.js +++ b/js/ui/dnd.js @@ -374,7 +374,8 @@ var _Draggable = class _Draggable { this._finishAnimation(); this._dragActor = null; - this._dragState = DragState.CANCELLED; + if (this._dragState == DragState.DRAGGING) + this._dragState = DragState.CANCELLED; }); this._dragOrigOpacity = this._dragActor.opacity; if (this._dragActorOpacity != undefined)